﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMK.Framework.Model;
using XMK.Tadong.Data;
using XMK.Tadong.Model;
using XMK.Utils;
using XMK.Tadong.Model.Cond;
using System.Data;

namespace XMK.Tadong.Biz
{
    public class Base_OrganizationBiz
    {
        
        public ResponseInfo GetOrganizeList()
        {
            ResponseInfo response = null;
            try
            {
                Base_OrganizationData data = new Base_OrganizationData(Config.TadongDbProvider);
                response = new ResponseInfo();
                response.Data = (List<Base_OrganizationInfo>)data.GetOrganizeList();
            }
            catch (Exception ex)
            {
                //生成返回对象（带错误信息）
                response = new ResponseInfo("error！");
                LogHelper.WriteLog(LogType.Error, "[GetOrganizeList:]" + ex.ToString());
            }
            return response;
        }
        /// <summary>
        /// 根据部门id获取部门信息
        /// </summary>
        /// <param name="orgID"></param>
        /// <returns></returns>
        public Base_OrganizationInfo getOrgInfoById(string orgID)
        {
            Base_OrganizationData data = new Base_OrganizationData(Config.TadongDbProvider);
            return data.getOrgInfoById(orgID);
        }
        /// <summary>
        /// 获取当前用户直属单位名-单位级别为“单位”
        /// </summary>
        /// <param name="orgID"></param>
        /// <returns></returns>
        public DataTable getOrgNameByUserId()
        {
            string USER_ACCOUNT = LoginUserBiz.LoginUserID();
            Base_OrganizationData data = new Base_OrganizationData(Config.TadongDbProvider);
            return data.getOrgNameByUserId(USER_ACCOUNT);
        }
    }
}
